home *** CD-ROM | disk | FTP | other *** search
- # Jedi Knight Cog Script
- #
- # POW_SABER.COG
- #
- # POWERUP Script - Lightsaber pickup
- #
- # [YB & CYW]
- #
- # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
-
-
- symbols
-
- thing powerup local
- thing player local
- int bin=11 local
- sound pickupsnd=thrmlpu2.wav local
- sound respawnsnd=Activate01.wav local
- flex amount local
-
- int autopickup=0 local
-
- message touched
- message taken
- message respawn
-
- end
-
- # ========================================================================================
-
- code
-
- touched:
- player = GetSourceRef();
- if (GetWeaponBin(bin) != -1)
- {
- amount = GetInv(player, GetWeaponBin(bin));
-
- if (IsMulti() || (amount < GetInvMax(player, GetWeaponBin(bin))))
- {
- TakeItem(GetSenderRef(), -1);
- call taken;
- }
- }
-
- Return;
-
- # ........................................................................................
-
- taken:
- player = GetSourceRef();
- powerup = GetSenderRef();
-
- if (GetWeaponBin(bin) != -1)
- {
- // Print("Lightsaber");
- jkPrintUNIString(player, GetWeaponBin(bin));
-
- // Do effects.
- PlaySoundLocal(pickupsnd, 1, 0, 0);
- AddDynamicTint(player, 0.0, 0.0, 0.2);
-
- // Increment powerup amount.
- SetInv(player, GetWeaponBin(bin), 1.0);
-
- // Check for Auto Pickup
- autopickup = GetAutoPickup();
- if(autopickup & 1)
- {
- if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, bin, 0))))
- {
- if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
- {
- SelectWeapon(player, bin);
- Return;
- }
- }
- }
- }
-
- Return;
-
- # ........................................................................................
-
- respawn:
- PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
-
- Return;
-
- end
-